<!--link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl.WWWROOT_BACKEND; ?>/css/form.css"/-->

<div class="widget-box dataTables_wrapper">
<?php $form = $this->beginWidget('GxActiveForm', array(
	'id' => 'country-form',
	//'enableAjaxValidation' => true,
  'htmlOptions'=>array('enctype'=>'multipart/form-data', 'class'=>'form-horizontal'),
));
?>
	<fieldset>
	<?php echo $form->errorSummary($model); ?>
		<div class="control-group">
			<?php echo $form->labelEx($model,'name', array('class'=>'control-label')); ?>
			<div class="controls">
			<?php echo $form->textField($model, 'name', array('maxlength' => 128)); ?>
			<?php echo $form->error($model,'name'); ?>
			<script type="text/javascript" language="javascript">
				jQuery(document).ready(function() {
					$('#Country_name').keyup(function(){
						createAlias();
					});
					$('#Country_name').focusout(function(){
						createAlias();
					});
									
					function createAlias()
					{
						var value = $('#Country_name').val();
						value = value.replace(/[áàảãạăắằẳẵặâấầẩẫậ]/ig, 'a');
						value = value.replace(/[đ]/ig, 'd');
						value = value.replace(/[éèẻẽẹêếềểễệ]/ig, 'e');
						value = value.replace(/[íìỉĩị]/ig, 'i');
						value = value.replace(/[óòỏõọôốồổỗộơớờởỡợ]/ig, 'o');
						value = value.replace(/[úùủũụưứừửữự]/ig, 'u');
						value = value.replace(/[ýỳỷỹỵ]/ig, 'y');
						value = value.replace(/[^A-Za-z0-9\s_-]/ig, '');
						value = value.replace(/\s/ig, '-');
						value = value.toLowerCase();
						$('#Country_alias').val(value);
					}
				});
			</script>
			</div>
		</div><!-- wd-input -->
		<div class="control-group">
			<?php echo $form->labelEx($model,'alias', array('class'=>'control-label')); ?>
			<div class="controls">
			<?php echo $form->textField($model, 'alias', array('maxlength' => 128)); ?>
			<?php echo $form->error($model,'alias'); ?>
			</div>
		</div><!-- wd-input -->
		
		<div class="form-actions">
		<?php echo GxHtml::submitButton(Yii::t('app', 'Save'), array('class'=>'btn btn-primary')); ?>
		</div>
	</fieldset>

<?php
$this->endWidget();
?>
</div><!-- form -->